﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "ui_MainWindow.h"

class FrameHelper;
class SheetListCtrl;
class SheetInterface;
class TicketQuery;
class MainWindow : public QMainWindow
{
	Q_OBJECT

public:
	MainWindow(QWidget *parent = 0);
	~MainWindow();

protected:
	void initMainWindow();
	void initCzpList();
	void initMenu();
	void initUIData();

	void hideWidgets();
	void displayTime();
	void setWidgetStatus(QToolButton * btn, QWidget * w);

    bool deleteTabWidget(QWidget * widget);
	void setTabWidget(QWidget * widget, const QString & name);

	void mouseDoubleClickEvent(QMouseEvent *event);

protected slots:
	void on_btnCzpList_clicked();
	void on_btnIndex_clicked();
	void on_btnOption_clicked();
	void on_btnHide_clicked();

	void on_listCzpList_clicked(const QModelIndex & index);
	//void on_listCzpList_expanded(const QModelIndex &index);

	void openTicket(int sheetid, int sheetBox, const QString & sheetname);
	void on_sheetListView_doubleClicked(int, int, const QString &);

	void on_tabWidget_close(int index);
	void onTimer();

	void on_pLogOff(bool checked);
	void on_pQuit(bool checked);
	void on_pChangePassword(bool checked);

	void changePasswd(bool bSuceess);

private:
	Ui::MainWindow ui;
	QTimer * pTimer;
	FrameHelper * pFrameHelper;
	SheetListCtrl * pSheetList;
	SheetInterface * pSheetInterface;
	QRecordTreeModel * pCzpListModel;
	
	QMenu * pMenu;
	QAction * pLogOff;//注销
	QAction * pQuit;//退出
	QAction * pChangePassword;//修改密码
};

#endif // MAINWINDOW_H
